﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LocalServer.Utils
{
    public class CardUtil
    {
        public static string ByteArrayToHexString(byte[] dataHex, int start, int len)
        {
            if (start >= dataHex.Length || (start + len) > dataHex.Length)
            {
                throw new Exception("The index or length position is not within string.");
            }
            string str = "";
            for (int i = start; i < start + len; i++)
            {
                try
                {
                    str += dataHex[i].ToString("X2");
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }

            return str;
        }
    }
}
